home *** CD-ROM | disk | FTP | other *** search
Wrap
/* *************************************************************** ** ** ** STAR TREK - THE FINAL FRONTIER ** ** ** ** Written by Steve Berry ** ** ** ** Rev A - 4/24/87 IBM 370 ** ** ** ** Rev B - 5/21/88 modified to run on Amiga ** ** ** ** Mods for Atredes by Bob Hassel and Michael Cox ** ** ANSI version & other enhancements by Michael Cox ** ** ** ** Checks for dropped carrier & inactivity logoff. ** ** ** ** Change 'maxtime' to control maximum play time. ** ** ** ** 10/02/91 -- Added UPPERcase conversion for the two ** ** prompts-INSTRUCTIONS and LOAD OLD GAME ** ** Syd L. Bolton, Legendary Design Tech. Inc. ** ** ** ** 10/04/91 -- Fixed up logic problems when loading old ** ** games (always had default energy & so on) ** ** Made small cosmetic changes, added SAVE ** ** option when quitting. ** ** Syd L. Bolton, Legendary Design Tech. Inc. ** ** ** ** 12/28/91 -- Modified by James R. Graham of ** ** The Portal Dolmen BBS (812)334-0418 to ** ** work with TransAmiga BBS, version 1.1. ** ** ** ** 04/09/94 -- Modified by Janne Siren (jts@krk.fi) of ** ** Epsilon Indi BBS +358-0-505-4201 to work ** ** with TechnoBBS. Several improvements: ** ** - instructions in a separate file ** ** - faster cursor movement using ANSI codes ** ** - better outlook ** ** - optional IBM character graphics ** ** - new command REDRAW ** ** - faster quadrant printing ** ** - better error checking ** ** - shooting a base will take 300 points ** ** - mission completed bonus (500 points) ** ** - a warp to the same quadrant is ignored ** ** - optimizations (script 11k smaller) ** ** - many bugs fixed ** ** ** ** 04/10/94 -- More accurate text centering and some ** ** unnecessary redraws removed. Energy is ** ** always displayed as an integer. Quadrant ** ** printing is slightly faster. Collisions ** ** are reported correctly. [JtS] ** ** ** ** 04/10/94 -- Sets user status to 'Playing Star Trek'. ** ** Faster quadrant printing. Color strip ** ** warning. [JtS] ** ** ** ** 04/10/94 -- Login menu, user preferences and optional ** ** screen bouncing when the Enterprise is hit. ** ** Old saved games are not compatible! [JtS] ** ** ** ** TechnoBBS installation: ** ** ** ** - Move included files to Doors:StarTrek directory. ** ** - Add following command to your menu and compile it. ** ** ** ** Command "TREK" ** ** { ** ** dos("rx >NIL: Doors:StarTrek/StarTrek.rexx \(node())"); ** ** } ** ** ** *************************************************************** $VER: Star Trek 1.23 (10.4.94) */ Signal On IoErr ; Signal On Syntax maxtime = 2000 CR = D2C(13) LF = D2C(10) CLS = D2C(12) CRLF = CR||LF ln = Arg(1) LineName = Con_LineActive(ln) If LineName = "" Then Exit 10 Address Command Address Value LineName SetStatus "Playing Star Trek" uname = GetUserName(ln) highest = 0 ; highname = 0 Call Time "R" Do I = 1 To 10 highscore.I = 0 highname.I = "" End stardate = Time("E") ibm = 0 ; bounce = 0 bar.0 = "--------------------------------------------------------------------------------" bar.1 = "ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ" If GetStripAll(ln) Then Do SendModem CLS||CRLF||"You need an ANSI-compatible terminal to play this game!"||CRLF||CRLF Exit 0 End If GetStripCols(ln) Then Do rs = GetYesNo(ln, CLS||CRLF||"Playing Star Trek without colors is not adviseable. Continue?", 0, 1) If rs = 0 Then Do SendModem CRLF||CRLF Exit 0 End End Call Old_Highest Call Load_Preferences SendModem CLS||CRLF||"CWelcome to Star Trek v1.23!"||CRLF||CRLF"CBrought to you by contributing authors: "||CRLF||CRLF||" Steve Berry, Bob Hassel, Michael Cox, Syd Bolton, James Graham and Janne Siren7HPress (RETURN) to continue: " GetHotkey(ln) quit = 0 ; saved = 0 ; alive = 1 ; mission = 1 Call Redraw_Menu Do Until quit = 1 rs = Upper(GetHotkey(ln, "36HSelect: ")) SendModem rs Select When rs = "1" Then Do quit = 1 End When rs = "2" Then Do quit = 1 saved = 1 End When rs = "3" Then Do Call Instructions 0 Call Redraw_Menu End When rs = "4" Then Do Call Display_Scores Call Redraw_Menu End When rs = "5" Then Do Call Preferences Call Redraw_Menu End When rs = "Q" Then Do SendModem CLS||CRLF Exit 0 End Otherwise Nop End End If saved = 1 Then Call Load_Old_Game Call Init_Variables_1 Start_Mission: starttime = stardate Call Redraw_Screen 1 doprint = 1 Do Until energy = 0 If doprint = 1 Then Call Print_Quadrant doprint = 1 t0 = Time("R") If stardate - starttime > maxtime Then Call Too_Long instring = Upper(AskInput(ln, "HCYour command, Captain? ", "", 20, "CAPITAL")) rc = Parse_Command(instring) If rc = 0 Then Do Do loop = 1 To 3 If arg1.loop = "" Then Leave Call Process_Command arg1.loop, arg2.loop If alive = 0 | energy <= 0 Then Leave End End Else Do SendModem CRLF||"CCommand not understood. Enter HELP for reminder." GetHotkey(ln) End If missstat = 1 Then Do points = points + 500 SendModem CLS||CRLF||"Congratulations! You have completed the mission!"||CRLF||CRLF"You got "||points||" points. Play again soon!"||CRLF||CRLF Call New_Highest Exit 0 End If alive = 0 | energy <= 0 Then Do SendModem CLS||CRLF||"Suicide is not in the best interests of the Federation."||CRLF||CRLF||"You got "||points||" points. Play again soon!"||CRLF||CRLF Call New_Highest Exit 0 End Call Wear_And_Tear If alive = 0 Then Do SendModem CLS||CRLF||"Sorry, but you let the Enterprise detoriorate"||CRLF||"into a rusting hunk of space debris."||CRLF||CRLF||"You got "||points||" points. Play again soon!"||CRLF||CRLF Call New_Highest Exit 0 End Call Mission_1 If alive = 0 Then Do SendModem CLS||CRLF||"Sorry, but you let your crew and the Federation down."||CRLF||CRLF||"You got "||points||" points. Play again soon!"||CRLF||CRLF Call New_Highest Exit 0 End End Exit 0 Load_Old_Game: missstat = 0 LockCarrier If ~Open(fnn, "Doors:StarTrek/_"||uname||".dat", "R") Then UnLockCarrier Else Do Readln(fnn) inn = Readln(fnn) If inn ~= "" Then Do Parse Var inn stardate " " mission " " energy " " points " " x " " y " " ex " " ey " " shields " " klshields " " status.0 " " status.1 " " status.2 " " status.3 " " status.4 " " status.5 " " kltot " " docked stardate = stardate + Time("E") Do L = 0 To 9 inn = Readln(fnn) Parse Var inn map.L.0 " " map.L.1 " " map.L.2 " " map.L.3 " " map.L.4 " " map.L.5 " " map.L.6 " " map.L.7 " " map.L.8 " " map.L.9 End Do L = 0 To 9 inn = Readln(fnn) Parse Var inn quad.L.0 " " quad.L.1 " " quad.L.2 " " quad.L.3 " " quad.L.4 " " quad.L.5 " " quad.L.6 " " quad.L.7 " " quad.L.8 " " quad.L.9 End Close(fnn) UnLockCarrier Call Start_Mission End End Return Init_Variables_1: energy = 1000000 ; x = 0 ; y = 0 ; points = 0 ; mission = 1 shields = 0 ; missstat = 0 ; kltot = 0 Do A = 0 To 9 Do B = 0 To 9 map.A.B = Random(0, 1) * 100 + Random(0, 1) * 10 + Random(0, 9) If map.A.B > 99 Then kltot = kltot + 1 End End klshields = 5000 ; status.0 = 0 ; status.1 = 0 ; status.2 = 0 status.3 = 0 ; status.4 = 0 ; status.5 = 0 ; ex = 5 ; ey = 4 New_Screen: enemies = map.x.y % 100 bases = (map.x.y - enemies * 100) % 10 stars = map.x.y - enemies * 100 - bases * 10 Do I = 0 To 9 Do J = 0 To 9 quad.I.J = 0 End End quad.ex.ey = 1 Do A = 0 To stars - 1 rx = Random(0, 9) ry = Random(0, 9) If quad.rx.ry = 0 Then quad.rx.ry = 2 Else A = A - 1 End If enemies ~= 0 Then Do Do A = 0 To enemies - 1 rx = Random(0, 9) ry = Random(0, 9) If quad.rx.ry = 0 Then quad.rx.ry = 3 Else A = A - 1 End End If bases ~= 0 Then Do Do A = 0 To bases - 1 rx = Random(0, 9) ry = Random(0, 9) If quad.rx.ry = 0 Then quad.rx.ry = 4 Else A = A - 1 End End docked = 0 Return Print_Quadrant: Call Dock? stardate = stardate + Time("E") If status.5 < 1 | docked = 1 Then astr = bstr Else astr = "XXXIoIXXXXXXXXXXXXXXX" SendModem "" Do i0 = 0 To 9 line = ""||i0 + 6||";14H" Do j0 = 0 To 9 Select When quad.i0.j0 = 0 Then line = line||" " When quad.i0.j0 = 1 Then line = line||""||"IoI" When quad.i0.j0 = 2 Then line = line||""||" * " When quad.i0.j0 = 3 Then line = line||""||"<->" When quad.i0.j0 = 4 Then line = line||""||"(B)" Otherwise Nop End End Select When i0 = 0 Then line = line||"C"||stardate When i0 = 1 Then Do If energy > 10000 Then line = line||"C"||Left(energy % 1, 7) Else line = line||"C"||Left(energy % 1, 7)||" " End When i0 = 2 Then line = line||"C"||y||","||x When i0 = 3 Then line = line||"C"||ex||","||ey When i0 = 4 & docked = 1 Then line = line||"CDocked " When i0 = 4 & map.x.y > 99 & docked = 0 Then line = line||"CRed " When i0 = 4 & map.x.y < 100 & docked = 0 Then line = line||"CGreen " When i0 = 5 Then Do If shields = 1 Then line = line||"CUp " Else line = line||"CDown " End When i0 = 8 Then line = line||"C"||Left(kltot, 2) When i0 = 9 Then line = line||"C"||Left(points, 5) Otherwise Nop End SendModem line End Return Parse_Command: Parse Arg arg1.1 arg2.1 arg1.2 arg2.2 arg1.3 arg2.3 comstr = "FIRTORPHASENRAILOWSHIWARIMPSAVQUIDRISTAHELPOWRED" If arg1.1 = "" Then Return 0 Do I = 1 To 3 arg1.I = Left(arg1.I, 3) arg2.I = Left(arg2.I, 3) If arg1.I = "" Then Leave Do J = 0 To 16 If arg1.I = SubStr(comstr, J * 3 + 1,3) Then Leave End If J > 16 Then Return -1 If arg2.I = "" Then Return 0 Do J = 0 To 16 If arg2.I = SubStr(comstr, J * 3 + 1,3) Then Leave End If J > 16 Then Return -1 End Return 0 Process_Command: Arg word1, word2 Select When word1 = "FIR" Then Call Weapon_Control word2 When word1 = "SEN" Then Call Sensors When word2 = "SHI" Then Call Shield_Control word1 When word2 = "DRI" Then Call Engine_Control word1 When word2 = "POW" Then Call Engine_Control word1 When word1 = "HEL" Then Call Instructions 1 When word1 = "SAV" Then Call Save_Game When word1 = "STA" Then Call Display_Info When word1 = "RED" Then Do Call Redraw_Screen 0 End When word1 = "QUI" Then Do If GetYesNo(ln, "HCQuit: Save the game in progress?", 1, 1) Then Call Save_Game SendModem CLS||CRLF Exit 0 End Otherwise Nop End Return Weapon_Control: Arg weapon If (weapon ~= "PHA") & (weapon ~= "TOR") Then Do SendModem "HCI am confused by that order, Captain." GetHotkey(ln) Return End If weapon = "PHA" Then Do If map.x.y < 100 Then Do SendModem "HCNo targets!" GetHotkey(ln) Return End kx = 0 ky = 0 Do I = 0 To 9 Do J = 0 To 9 If quad.I.J = 3 Then Do kx = I ky = J End End End distance = ((ex - kx) * * 2 + (ey - ky) * * 2) Do I = 1 To 13 By .5 t0 = distance / I If t0 < I Then Leave End distance = I energy = energy - 5000 hit = (1 - status.1) * 5000 - (distance * 500) If hit < 0 Then hit = 0 klshields = klshields - hit SendModem "HCPhasers locked on target! Phasers fired!" If klshields <= 0 Then Do string = "Klingon hit with "||hit % 1||" units of energy! Klingon Destroyed!" SendModem ""||(81 - Length(string)) % 2||"H"||string points = points + 50 klshields = 5000 quad.kx.ky = 0 map.x.y = map.x.y - 100 kltot = kltot - 1 End Else Do string = "Klingon hit with "||hit % 1||" units of energy! Still alive!" SendModem ""||(81 - Length(string)) % 2||"H"||string End GetHotkey(ln) End Else Do Do Until C = 0 dy = AskInput(ln, "13HX vector, Captain (-1 = left, 0 = middle, 1 = right)? ", "", 3) dx = AskInput(ln, "13HY vector, Captain (-1 = up, 0 = middle, 1 = down)? ", "", 3) If dx = "" Then dx = 0 If dy = "" Then dy = 0 If (dx = -1 | dx = 0 | dx = 1) & (dy = -1 | dy = 0 | dy = 1) Then C = 0 Else C = 1 End tx = ex ty = ey Do lp = 0 To 9 t0 = tx+dx t1 = ty+dy If (t0 < 0) | (t0 > 9) | (t1 < 0) | (t1 > 9) Then Do SendModem "HCTorpedo missed!" GetHotkey(ln) Return End space = quad.t0.t1 If space ~= 0 Then Select When space = 2 Then Do SendModem "HCTorpedo hits a star!" GetHotkey(ln) Return End When space = 3 Then Do SendModem "HCTorpedo hits a Klingon! Enemy ship destroyed! Good shot, Captain!" GetHotkey(ln) quad.t0.t1 = 0 map.x.y = map.x.y - 100 kltot = kltot - 1 points = points + 100 Return End When space = 4 Then Do SendModem "HCTorpedo hits a base! Court martial is imminent!" GetHotkey(ln) If points >= 300 Then points = points - 300 Else points = 0 Return End Otherwise Do SendModem "HCTorpedo hits the deathstar! Torpedo seems to have no effect!" GetHotkey(ln) Return End End quad.t0.t1 = 6 tx = t0 ty = t1 quad.tx.ty = 0 End End Return Wear_And_Tear: If alive = 0 Then Return pick = Random(0, 5) If docked = 1 Then If status.pick = 0 Then Return Else status.pick = status.pick - .1 Else Do If status.pick < 1 Then Do status.pick = status.pick + .1 If status.pick = 1 Then Do SendModem "HCStatus Report:"||CRLF||CRLF Select When pick = 0 Then SendModem "CComputer is in need of repair!" When pick = 1 Then SendModem "CPhasers are in need of repair!" When pick = 2 Then SendModem "CTorpedos are in need of repair!" When pick = 3 Then SendModem "CWarp drive is in need of repair!" When pick = 4 Then SendModem "CImpulse drive is in need of repair!" When pick = 5 Then SendModem "CSensors are out of order!" End If status.3 > .9 & status.4 > .9 Then Do SendModem "3HSir, we seem to be dead in space! The warp and the impulse drive are out!" alive = 0 End GetHotkey(ln) doprint = 1 End End End Return Engine_Control: Arg power If power = "WAR" Then Do If status.3 > 1.2 Then Do SendModem "HCSorry Captain, warp drive is out of commission!" GetHotkey(ln) Return End dy = AskInput(ln, "HCDestination X coordinate (0-9)? ", "", 2, "NUMERIC") dx = AskInput(ln, "14HDestination Y coordinate (0-9)? ", "", 2, "NUMERIC") If dx = y & dy = x Then Return If dx = "" Then dx = 0 If dy = "" Then dy = 0 If x > 9 | y < 0 | x < 0 | y > 9 Then Do energy = energy - 5000 SendModem "HCCaptain, the warp drive is in a bad way and we are losing energy fast!" GetHotkey(ln) End energy = energy - ((((dx - x) * * 2 + (dy - y) * * 2) / 2.5) * 1000 + status.3 * 5000) If shields = 0 Then Do If bounce = 1 Then SendModem "ST" SendModem "H Shields are down! The Enterprise is caught in the void of intergalatic space!6HDamage Report: Warp drive damaged, impulse drive damaged, sensors out!" GetHotkey(ln) status.3 = status.3 + 1 status.4 = status.4 + 1 status.5 = 1.1 End Else energy = energy - 5000 x = dx y = dy If x > -1 & x < 10 & y > -1 & y < 10 Then Do doprint = 0 Call New_Screen Call Print_Quadrant End End Else Do If power ~= "IMP" Then Return If status.4 > .9 Then Do SendModem "HCSorry Captain, impulse drive is out of commission!" GetHotkey(ln) Return End factor = AskInput(ln, "14HWhat impulse factor, Captain? ", "", 2, "NUMERIC") If factor = "" Then factor = 0 Do Until C = 0 dy = AskInput(ln, "13HX vector, Captain (-1 = left, 0 = middle, 1 = right)? ", "", 3) dx = AskInput(ln, "13HY vector, Captain (-1 = up, 0 = middle, 1 = down)? ", "", 3) If dx = "" Then dx = 0 If dy = "" Then dy = 0 If (dx = -1 | dx = 0 | dx = 1) & (dy = -1 | dy = 0 | dy = 1) Then C = 0 Else C = 1 End Do I = 0 To factor - 1 If ((ex + dx) < 0) | ((ex + dx) > 9) | ((ey + dy) < 0) |((ey + dy) > 9) Then Do SendModem "HCYou have to use the warp drive to exit the quadrant." GetHotkey(ln) Return End t0 = ex + dx t1 = ey + dy space = quad.t0.t1 If space ~= 0 Then Do Select When space = 2 Then Do SendModem "HCCollission with a star!" alive = 0 End When space = 3 Then Do SendModem "HCCollission with a Klingon!" alive = 0 End When space = 4 Then Do SendModem "HCCollission with a base!" alive = 0 End Otherwise Do SendModem "HCSwallowed by the deathstar!" alive = 0 End End I = factor - 1 GetHotkey(ln) End quad.ex.ey = 0 quad.t0.t1 = 1 ex = t0 ey = t1 End If alive = 1 & factor > 0 Then Do doprint = 0 Call Print_Quadrant End End Return Dock?: docked = 0 Do i1 = -1 To 1 Do j1 = -1 To 1 If i1+ex > -1 & i1+ex < 10 & j1+ey > -1 & j1+ey < 10 Then Do ta = i1+ex tb = j1+ey If quad.ta.tb = 4 Then Do docked = 1 t = status.0 + status.1 + status.2 + status.3 + status.4 + status.5 stardate = stardate + t status.0 = 0 status.1 = 0 status.2 = 0 status.3 = 0 status.4 = 0 status.5 = 0 End End End End If kltot = 0 Then missstat = 1 Return Save_Game: missstat = 0 LockCarrier If ~Open(fnn, "Doors:StarTrek/_"||uname||".dat", "W") Then Do UnLockCarrier SendModem "HCError: Unable to open save file! Try again!" GetHotkey(ln) Return End SendModem "HCStoring your game..." Writeln(fnn, ibm bounce||Left(" ", 60)) Writeln(fnn, stardate mission energy points x y ex ey shields klshields status.0 status.1 status.2 status.3 status.4 status.5 kltot docked) Do L = 0 To 9 Writeln(fnn, map.L.0 map.L.1 map.L.2 map.L.3 map.L.4 map.L.5 map.L.6 map.L.7 map.L.8 map.L.9) End Do L = 0 To 9 Writeln(fnn, quad.L.0 quad.L.1 quad.L.2 quad.L.3 quad.L.4 quad.L.5 quad.L.6 quad.L.7 quad.L.8 quad.L.9) End Close(fnn) UnLockCarrier Return Sensors: If status.5 < 1.1 Then Do If ibm = 1 Then Do SendModem "49HÚÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄ¿" br = " ³ " End Else Do SendModem "49H-------------------" br = " " End P = 0 Do I = -1 To 1 P = P + 1 If I ~= -1 Then Do If ibm = 1 Then SendModem ""||12 + P||";48H ÃÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄ´ " Else SendModem ""||12 + P||";48H ------------------- " End P = P + 1 line = ""||12 + P||";48H"||br Do J = -1 To 1 t0 = x + I t1 = y + J If t0 < 0 | t0 > 9 | t1 < 0 | t1 > 9 Then line = line||"XXX"||br Else Do If map.t0.t1 < 100 & map.t0.t1 > 9 Then line = line||" " If map.t0.t1 < 10 Then line = line||" " line = line||map.t0.t1||br End End SendModem line End If ibm = 1 Then SendModem "49HÀÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÙ" Else SendModem "49H-------------------" GetHotkey(ln); If ibm = 1 Then SendModem "49H " Else SendModem "49H" SendModem "49HKlingons: "||Left(kltot, 8)||"49HScore: "||Left(points, 8) If ibm = 1 Then SendModem "49H 48HÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;" Else SendModem "49H48H======================" End Else Do SendModem "HCLong-range sensors are out, Captain!" GetHotkey(ln); End Return Shield_Control: Arg direction If direction = "RAI" Then If shields = 1 Then Do SendModem "HCShields are already up!" End Else Do shields = 1 SendModem "HCShields up, Captain." energy = energy - 3000 End Else If direction = "LOW" Then If shields = 0 Then Do SendModem "HCShields are already down!" End Else Do shields = 0 SendModem "HCShields down, Captain." energy = energy + 3000 End Else SendModem "HCI am confused by that order, Captain." GetHotkey(ln) Return Display_Info: title = "Status report for Enterprise - Stardate "||stardate SendModem CLS||CRLF||title||CRLF||""||Left(bar.ibm, Length(title))||" "||CRLF c = 100 - status.0 * 100 SendModem "Computer"||Length(title) - Length(c) - 9||"C"||c||"%"||CRLF c = 100 - status.1 * 100 SendModem "Phasers"||Length(title) - Length(c) - 8||"C"||c||"%"||CRLF c = 100 - status.2 * 100 SendModem "Torpedos"||Length(title) - Length(c) - 9||"C"||c||"%"||CRLF c = 100 - status.3 * 100 SendModem "Warp drive"||Length(title) - Length(c) - 11||"C"||c||"%"||CRLF c = 100 - status.4 * 100 SendModem "Impulse drive"||Length(title) - Length(c) - 14||"C"||c||"%"||CRLF c = 100 - status.5 * 100 SendModem "Sensors"||Length(title) - Length(c) - 8||"C"||c||"%"||CRLF||CRLF Call Hit_Return Call Redraw_Screen 0 Return Instructions: Arg game SendASCII "Doors:StarTrek/Instructions.txt" Call Hit_Return If game = 1 Then Call Redraw_Screen 0 Return Hit_Return: GetHotkey(ln, "Hit (RETURN) to continue: "); Return Mission_1: If map.x.y > 99 Then Do Do I = 0 To 9 Do J = 0 To 9 If quad.I.J = 3 Then Do tx = I ty = J End End End If tx > ex Then t0 = -1 If tx = ex Then t0 = 0 If tx < ex Then t0 = 1 If ty > ey Then t1 = -1 If ty = ey Then t1 = 0 If ty < ey Then t1 = 1 factor = ((tx - ex) * * 2 + (ty - ey) * * 2) Do I = 1 To 13 By .5 tm = factor / I If tm < I Then Leave End factor = I % 1 kl = 1 ; iskl = 1 Do I = 0 To factor - 1 If factor < 1 Then Leave t2 = tx + t0 t3 = ty + t1 If t2 < 0 | t2 > 9 | t3 < 0 | t3 > 9 Then Leave space = quad.t2.t3 If space = 1 Then Leave If space ~= 0 & kl = 1 Then DO doprint = 1 Select When space = 2 Then Do SendModem "HCKlingon collides with a star!" GetHotkey(ln) quad.tx.ty = 0 map.x.y = map.x.y - 100 kltot = kltot - 1 kl = 0 End When space = 3 Then Do SendModem "HCKlingon collides with a Klingon!" GetHotkey(ln) quad.tx.ty = 0 quad.t2.t3 = 0 map.x.y = map.x.y - 200 kltot = kltot - 2 kl = 0 End When space = 4 Then Do SendModem "HCKlingon collides with a base!" GetHotkey(ln) quad.tx.ty = 0 quad.t2.t3 = 0 map.x.y = map.x.y - 100 kltot = kltot - 1 kl = 0 End Otherwise Do SendModem "HCKlingon swallowed by the deathstar!" GetHotkey(ln) points = points + 50 quad.tx.ty = 0 map.x.y = map.x.y - 100 kltot = kltot - 1 kl = 0 End End If kl = 1 Then Do quad.tx.ty = 0 quad.t2.t3 = 3 tx = t2 ty = t3 End End End If docked = 1 Then Return If kl = 1 Then Do amount = klshields / 5000 * Random(100, 500) * 10 If bounce = 1 Then SendModem "ST" If amount > 1000 & shields = 0 Then Do SendModem "HCKlingon fires phasers! Enterprise shields are down!9HEnterprise hit with "||amount||" units of energy! Enterprise destroyed!" GetHotkey(ln) doprint = 1 alive = 0 End If amount < 3000 & shields = 1 Then Do SendModem "HCKlingon fires phasers! Enterprise shields are up!24HShields absorb impact! No damage!" GetHotkey(ln) doprint = 1 energy = energy - amount End If amount > 3000 & shields = 1 Then Do string = "Enterprise hit with "||amount % 1||" units of energy!" SendModem "HCKlingon fires phasers! Enterprise shields are up!"||(81 - Length(string)) % 2||"H"||string GetHotkey(ln) doprint = 1 energy = energy - amount Do I = 0 To (amount - 3000) / 100 Call Wear_And_Tear End End If amount < 1001 & shields = 0 Then Do string = "Enterprise hit with "||amount % 1||" units of energy!" SendModem "HCKlingon fires phasers! Enterprise shields are down!"||(81 - Length(string)) % 2||"H"||string GetHotkey(ln) doprint = 1 Do I = 0 To amount / 100 Call Wear_And_Tear End End End End If map.x.y < 299 & alive = 1 Then Do found = 0 Do I = -1 To 1 Do J = -1 To 1 tx = I + x ty = J + y If (tx > -1) & (tx < 10) & (ty > -1) & (ty < 10) Then Do If (map.tx.ty > 99) & ((i ~=0 )|(j ~=0 )) Then Do found = 1 I = 1 J = 1 End End End End If found = 1 Then Do SendModem "HCCaptain! A Klingon warship has just warped into the quadrant!" GetHotkey(ln) doprint = 1 map.tx.ty = map.tx.ty - 100 map.x.y = map.x.y + 100 Do Until A = 1 rx = Random(0,9) ry = Random(0,9) If quad.rx.ry = 0 Then Do quad.rx.ry = 3 A = 1 End Else A = 0 End End End If kltot = 0 Then missstat = 1 Return Old_Highest: LockCarrier If ~Open(fnn, "Doors:StarTrek/Highscore.dat", "R") Then DO UnLockCarrier Return End Do I=1 To 10 highname.i = Readln(fnn) highscore.i = Readln(fnn) End Close(fnn) UnLockCarrier Return New_Highest: If uname = "" Then Return If points <= highscore.10 Then Return SendModem "You are in the top ten! Saving your name and score for posterity..." highscore.10 = points highname.10 = uname Do Forever changes = 0 Do i = 1 To 9 ih = i + 1 If highscore.ih > highscore.i Then Do temp = highscore.i tempname = highname.i highscore.i = highscore.ih highname.i = highname.ih highscore.ih = temp highname.ih = tempname changes = 1 End End If changes = 0 Then Leave End LockCarrier If ~Open(fnn, "Doors:StarTrek/Highscore.dat", "W") Then Do UnLockCarrier Return End Do i = 1 To 10 If Writeln(fnn, highname.i) < 1 Then Return If Writeln(fnn, highscore.i) < 1 Then Return End Close(fnn) UnLockCarrier SendModem CRLF||CRLF Return Too_Long: SendModem "HCSorry, time up for this round!" If GetYesNo(ln, "20HQuit: Save the game in progress?", 1, 1) Then Call Save_Game SendModem CLS||CRLF Exit 0 Redraw_Screen: Arg mode If mode = 0 Then SendModem CLS||"6HStar Trek - The Final Frontier1H" Else SendModem "HC" If ibm = 1 Then Do SendModem "ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸" Do I = 0 To 11 SendModem ""||I + 5||";11H³C³C³" End End Else SendModem "===========================================================" If ibm = 1 Then SendModem "11HÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;" Else SendModem "11H===========================================================" SendModem "9HStardate:9HEnergy:9HQuadrant:9HSector:49HCondition:49HShields:49HKlingons:49HScore: " Return Display_Scores: SendModem CLS||CRLF||"Top Ten Players"||CRLF||Left(bar.ibm, 45)||" "||CRLF Do I = 1 To 10 If highscore.I = 0 Then Iterate SendModem highname.I||""||45 - Length(highname.I) - Length(highscore.I)||"C"||highscore.I||CRLF End SendModem CRLF Call Hit_Return SendModem CLS Return Redraw_Menu: SendModem CLS||"6HStar Trek - The Final Frontier1H"||Left(bar.ibm, 40)||"8H(1) Play Star Trek8H(2) Load Saved Game28H(3) Instructions28H(4) Top Ten Players28H(5) Preferences28H(Q) Quit to Previous Menu21H"||Left(bar.ibm, 40)||" " Return Preferences: SendModem CLS||CRLF ibm = GetYesNo(ln, "CDoes your terminal support IBM characters?", 0, 1) SendModem CRLF||CRLF bounce = GetYesNo(ln, "CBounce the screen when the Enterprise is damaged?", 0, 1) Call Save_Preferences Return Load_Preferences: LockCarrier If ~Open(fnn, "Doors:StarTrek/_"||uname||".dat", "R") Then UnLockCarrier Else Do inn = Readln(fnn) Parse Var inn ibm " " bounce " " Close(fnn) UnLockCarrier End Return Save_Preferences: LockCarrier If ~Open(fnn, "Doors:StarTrek/_"||uname||".dat", "A") Then If ~Open(fnn, "Doors:StarTrek/_"||uname||".dat", "W") Then Do UnLockCarrier Return End Seek(fnn, 0, "Begin") Writeln(fnn, ibm bounce||Left("", 60)) /* length 64 bytes */ Close(fnn) UnLockCarrier Return IoErr: Syntax: Error: SendModem CRLF||CRLF||"Error: "||RC||" - "||ERRORTEXT(RC)||" @ "||SIGL||CRLF||CRLF Exit 0